<template>
	<view class="news_detail">
	<view class="news_title">
		{{newsDetail.title}}
	</view>
	<view class="info">
		<text>发表时间：{{newsDetail.add_time | formatDate}}</text>
		<text>浏览：{{newsDetail.click}}</text>
	</view>
	<view class="content">
		<rich-text :nodes="newsDetail.content"></rich-text>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				newsDetail:{}
			}
		},
		methods: {
			async getNewsDetail(id) {
				const res = await this.$myRequest({
					url: '/api/shop/getnews?id=' + id
				})
				console.log(res)
				this.newsDetail = res.data.message[0]
			}

		},
		onLoad(options) {
			this.getNewsDetail(options.id)
		}
	}
</script>

<style lang="scss">
	.news_detail {
		padding: 20rpx;

		.news_title {
			text-align: center;
			font-size: 32rpx;
		}

		.info {
			font-size: 28rpx;
			display: flex;
			justify-content: space-between;
		}
	}
</style>
